//
//  String+Extension.swift
//  WeiBo(Swift)
//
//  Created by 周成龙 on 16/9/28.
//  Copyright © 2016年 ZCL. All rights reserved.
//

import UIKit

extension String {
    func cachesDirectory() -> String {
        let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.cachesDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last!
        let filePath = (path as NSString).appendingPathComponent(self)
        return filePath
    }
    
    func documentDirectory() -> String {
        let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last!
        let filePath = (path as NSString).appendingPathComponent(self)
        return filePath
    }
    
    func tmpDirectory() -> String {
        let path = NSTemporaryDirectory()
        let filePath = (path as NSString).appendingPathComponent(self)
        return filePath
    }
}
